const EK_SHOW = 'show';

interface KHTMLElement {
    /**
     * 显示元素
     * @param visible <'display'> 显示属性 @see Evisible
     * @param detail 事件信息
     * @returns 当前元素对象
     */
    show(visible?: Evisible, detail?: any): KHTMLElement;
}
{
    const display = (value: string) => { return value === 'none'; };
    const visibility = (value: string) => { return value === 'hidden'; };
    Object.defineProperty(KHTMLElement.prototype, EK_SHOW, {
        writable: false,
        configurable: false,
        enumerable: false,
        value: function (this: KHTMLElement, visible = Evisible.display, detail?: any) {
            switch (visible) {
                case Evisible.display: {
                    this.resetStyle('display', display, 'initial');
                } break;
                case Evisible.visibility: {
                    this.resetStyle('visibility', visibility, 'visible');
                } break;
                case Evisible.both: {
                    this.resetStyle('display', display, 'initial');
                    this.resetStyle('visibility', visibility, 'visible');
                } break;
                default: throw new IllegalArgumentError();
            }
            return arguments.length === 1 ? this.action(EK_SHOW) : this.action(EK_SHOW, detail);
        }
    });
}
